home *** CD-ROM | disk | FTP | other *** search
- Path: sarah.netmedia.co.il!usenet
- From: davidb@netmedia.co.il (davidb)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: -> How do you use the EXTERN keyword? <-
- Date: Fri, 05 Jan 1996 21:00:30 GMT
- Organization: NetMedia
- Message-ID: <4ck798$ju@sarah.netmedia.co.il>
- References: <4chkq2$1s06@pulp.ucs.ualberta.ca>
- NNTP-Posting-Host: cs31a3.netmedia.net.il
- X-Newsreader: Forte Free Agent 1.0.82
-
- jbukczyn@gpu.srv.ualberta.ca (Jacob Bukczynski) wrote:
-
- >I need to use variables in two different source files in the
- >same project. I know that you need to declare them somehow
- >with the EXTERN keyword but I don't know how.
-
- >Please help! Reply by email if possible, or just follow-up
- >here. Thanks in advance.
-
- Declare the variables in a header file eg data.h:
-
- extern int myInteger
-
- You #include the above header file in all the source files in which
- you need to access the integer. In one of the source files you also
- define and initialise the integer outside a function body...
-
- int myInteger = 0; \\ or any other number
-
- That's all there is to it
-
- David Becher
-
-
-
-